#ifndef __RANGE_LOCK__
#define __RANGE_LOCK__

#include <st.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

struct RangeLock
{
	st_thread_t coroutines[2];
	int64_t locked_range[2][2];
};

void range_lock_init(struct RangeLock* lock);
void range_lock(struct RangeLock* lock, int index, int64_t low, int64_t high);
void range_unlock(struct RangeLock* lock, int index);

#ifdef __cplusplus
}
#endif

#endif

